package com.wen.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import com.wen.pojo.PurchaseOrderDetails;
import com.wen.pojo.dto.PurchaseOrderDetailsDto;
import com.wen.pojo.PurchaseOrderDetails;
import com.wen.pojo.dto.wen.PurchaseOrderDetailsDto;
import com.wen.pojo.dto.wen.PurchaseOrderDetailsSP;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface PurchaseOrderDetailsMapper extends BaseMapper<PurchaseOrderDetails> {

    @Select("SELECT pod.*,p.name,p.unit,p.picture FROM `purchase_order_details` pod INNER JOIN purchase_order po INNER JOIN product p WHERE pod.purchase_id=po.purchase_id AND pod.product_id=p.`id` AND po.purchase_order_number=${id}")
    List<PurchaseOrderDetailsDto>  SelAllId(String id);

    @Select("SELECT * FROM `purchase_order_details` pod,`product` p WHERE pod.`product_id` = p.id AND pod.`purchase_id`= #{id}")
    List<PurchaseOrderDetailsDto> selById(String id);

    @Select("SELECT * FROM `purchase_order_details` pod,`product` p WHERE pod.`product_id` = p.`id` AND pod.`purchase_id` = #{id}")
    List<PurchaseOrderDetailsSP> selPurchaseOrderDetailsSP(String id);

}
